<div class="modal fade bs-modal-lg" id="modelContent">
	<div class="modal-dialog modal-lg">
        <div class="modal-content"></div>
    </div>
</div>

<div class="portlet box green">
    <div class="portlet-title">
		<div class="caption"><i class="fa fa-cogs"></i>数据列表</div>
		<div class="tools"><a href="javascript:;" class="collapse" data-original-title="" title=""> </a></div>
     	<div class="actions">
			<a href="javascript:;" class="btn white btn-sm ajax-search"><i class="fa fa-search"></i> 查询 </a>
			<a href="javascript:;" class="btn white btn-sm search-reset"><i class="fa fa-eraser"></i> 清除 </a>
		</div>
    </div>
    <div class="portlet-body">
		<div class="tabbable-line ">
			<ul class="nav nav-tabs ">
				<li #if(!$quotationState) class="active" #end><a href="/quotation/list" class="ajaxify">全部</a></li>
				<li #if($quotationState=='WATI_QUOTATION') class="active" #end ><a href="/quotation/list?quotationState=WATI_QUOTATION" class="ajaxify"> 未议价</a></li>
				<li #if($quotationState=='BE_ON_QUOTATION') class="active" #end ><a href="/quotation/list?quotationState=BE_ON_QUOTATION" class="ajaxify"> 已议价</a></li>
				<li #if($quotationState=='PASS_QUOTATION') class="active" #end ><a href="/quotation/list?quotationState=PASS_QUOTATION" class="ajaxify"> 已通过</a></li>
				<li #if($quotationState=='DENY_QUOTATION') class="active" #end ><a href="/quotation/list?quotationState=DENY_QUOTATION" class="ajaxify"> 未通过</a></li>
			</ul>
			<div class="portlet-body form">
				<form action="/quotation/list" class="form-horizontal" method="get"
					id="searchForm" onsubmit="return false">
					<input type="hidden" name="quotationState" value="$!quotationState">
					<div class="form-body">
						<div class="form-group">
							<div class="alert alert-warning">
								<strong> 注：</strong>客户通过询价提交单据后，报价单将新增一个报价单。业务员点击编辑后进行报价，报价提交后交由相关人员审核。报价单审核通过后，企业可直接得到回复。
							</div>
						</div>
						<div class="row">
							<div class="form-group">
								<div class="col-md-3">
									<label class="col-md-4 control-label">单号：</label>
									<div class="col-md-8">
										<input type="text" class="form-control" name="id" value="$!id">
									</div>
								</div>
								<div class="col-md-3">
									<label class="col-md-4 control-label">企业：</label>
									<div class="col-md-8">
										<input type="text" class="form-control" name="companyName" placeholder="输入企业名称" value="$!companyName">
									</div>
								</div>
								<div class="col-md-3">
									<label class="control-label col-md-4">申请时间：</label> <label
										class="col-md-8"> <input class="form-control"
										type="text" name="startTime" id="startTime"
										value="$!startTime" readonly> <i
										class="fa fa-calendar"
										style="position: absolute; right: 10px; top: 10px"></i>
									</label>
								</div>
								<div class="col-md-3">
									<label class="control-label col-md-2">至：</label> <label
										class="col-md-8"> <input class="form-control"
										type="text" name="endTime" id="endTime" value="$!endTime"
										readonly> <i class="fa fa-calendar"
										style="position: absolute; right: 10px; top: 10px"></i>
									</label>
								</div>
							</div>
							<div class="form-group">
								<div class="col-md-3">
									<label class="col-md-4 control-label">会员号：</label>
									<div class="col-md-8">
										<input type="text" class="form-control" name="userInfoId" placeholder="请输入会员号" value="$!userInfoId">
									</div>
								</div>
							</div>
						</div>
					</div>
				</form>
			</div>
			<div class="tab-content">
				<div class="tab-pane active form">
			<div class="btn-group "  style="float:right" >
				<button type="button" class="btn white btn-sm delete-tab" data-toggle="dropdown"> 
					<i class="fa fa-cloud-download"></i> 导出
				</button>
				<ul class="dropdown-menu pull-right" role="menu">
					<li>
						<a href="javascript:;" class="export-tab"> <i class="fa fa-cube"></i>指定议价单</a>
					</li>
					<li>
						<a href="javascript:;" class="export-all"> <i class="fa fa-cubes"></i>全部议价单</a>
					</li>
				</ul>
			</div>
					<div class="table-container table-scrollable">
			
						<table class="table table-bordered table-hover icheck-table" id="productTable">
							<thead>
									<tr>
					  		 			<th style="width: 20px">
											<input type="checkbox" class="icheck group-icheck"/>
										</th>
						  		 			<th>议价单号</th>
						  		 			<th>企业名称</th>
						  		 			<th>申请会员</th>
						  		 			<th>货品</th>
						  		 			<th>售价总金额</th>
						  		 			<th>议价总金额</th>
						  		 			<th>申请时间</th>
						  		 			<th>议价时间</th>
						  		 			<th>状态</th>
										<th class="col-md-2">操作</th>
									</tr>
								</thead>
								<tbody>
								#foreach($item in $pageQuotation.result)
					 				<tr>  
									    <td>
									    	<input type="checkbox" name="checkboxes" class="icheck" value="$!item.id" />
								    	</td>
									    <td>$!item.id</td>
									    <td>$!item.companyName</td>
									    <td>$!item.userInfoId</td>
									    <td>$!item.productSkuNum</td>
									    <td>$!item.quotationSkuPrice</td>
									    <td>$!item.quotationPrice</td>
									    <td>$!item.timeString</td>
									    <td>$!item.quotationTimeString</td>
									    <td>$!item.quotationState.name</td>
						    			<td>
											<a class="btn green btn-outline btn-sm ajaxify" href="/quotationItem/edit?id=$!item.id"> 
												<i class="fa fa-edit"></i>	修改
											</a>
									    </td>		  			
					 				</tr>
					 				<form id="downfile" action="" class="hide"  method="POST">
					 						<input type="hidden" value="" name="pid" id="pid">
					 						<input type="hidden" name="flag" value="$!quotationState">
					 				</form>
					 				
								#end
								</tbody>
							</table>
					</div>
					#set($page= $pageQuotation)
					#set($pageUrl="/quotation/list?$!queryString&pageNo=")
					#parse("_page.htm")
				</div>
			</div>
		</div>
    </div>
</div>
<script type="text/javascript">
     $("input[name=id]").focus();
     
     
     //获取 选中数组
     function getcbvalue(){
  		var array = new Array()
  		var target= $("input[name='checkboxes']");
  		//循环加入数组
  		
  			$.each(target,function(i,v){
  				if(v.checked){
  					array.push($(v).val());
  				}
  			});
 		 	return array; 
 	  }
     /**
     *
     * excel 导出
     */
    $(".export-tab").click(function(){
   	 var pIdArray= getcbvalue();
   	 if(pIdArray.length>0){
  		    $("#pid").val(pIdArray);
  		    $("#downfile").attr("action","/quotation/downloadExcel");
  			$("#downfile").submit();
   	 }else{
   		 toastr.warning("请选择议价单");
   	 }
    })
    /*
     *  excel 导出全部
     */
    $(".export-all").click(function(){
	    	$("#pid").val("");
 		    $("#downfile").attr("action","/quotation/downloadExcel");
 			$("#downfile").submit();
    })
     
     
</script>
<script src="/assets/scripts/views-date.js" type="text/javascript"></script>
<script type="text/javascript" src="/assets/scripts/views-icheck.js"></script>